#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main()
{
	int n = 0, m = 0, i = 0, h = 0;
	for (n = 0; n < 100000; n++)
	{
		int j = 0;
		m = h = n;
		for (i = 0; m != 0; i++)
		{
			m = m / 10;
		}
		for (int k = 0; k < i; k++)
		{
			j = j + pow(h % 10, i);
			h = h / 10;
		}
		if (j == n)
			printf("%d ", n);
	}
	return 0;
}